package com.seleniti.enpareja.controller.model.integration.database.domain;

import java.util.Date;

import javax.jdo.annotations.Column;
import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.Version;
import javax.jdo.annotations.VersionStrategy;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
@Version(column = "version", strategy = VersionStrategy.VERSION_NUMBER, extensions = { @Extension(vendorName = "datanucleus", key = "field-name", value = "version") })
public class HomeTask {

	public enum MadeBy {
		MEMBER_1, MEMBER_2, BOTH;
	}

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String homeTaskId;

	@Column(allowsNull = "false")
	@NotNull
	private Couple couple;
	
	@Column(length=150)
	@Size(max=150)
	private String text;

	@Column
	private Date lastTime;

	@Column
	private MadeBy madeBy;

	protected long version;

	public String getHomeTaskId() {
		return homeTaskId;
	}

	public void setHomeTaskId(String homeTaskId) {
		this.homeTaskId = homeTaskId;
	}

	public Couple getCouple() {
		return couple;
	}

	public void setCouple(Couple couple) {
		this.couple = couple;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Date getLastTime() {
		return lastTime;
	}

	public void setLastTime(Date lastTime) {
		this.lastTime = lastTime;
	}

	public MadeBy getMadeBy() {
		return madeBy;
	}

	public void setMadeBy(MadeBy madeBy) {
		this.madeBy = madeBy;
	}

	@Override
	public String toString() {
		return "HomeTask [homeTaskId=" + homeTaskId + ", text=" + text
				+ ", lastTime=" + lastTime + ", madeBy=" + madeBy + "]";
	}

}
